import requests

# # 请求帕拉梅拉 图片
# url_plml = "https://p3.toutiaoimg.com/img/motor-article-img/0fb38a806a504d9b931fe170a9dba8a9~tplv-shrink:1118:838.jpeg?from=post"
# res = requests.get(url=url_plml)
# print(res)
#
# plml_data = res.content  # 获取响应的二进制内容
#
# f = open("plml.png", mode="wb")  # w代表覆盖写入，b代表二进制打开
# # mode代表模式   读 r read，写w write
# f.write(plml_data)
# f.close()

# 商城 获取用户账户明细

# 域名
host = "https://mall.deyunce.com/"

# api 接口地址
api_account_log = "api/user/accountLog"

# 拼接成完整的url地址
url_account_log = host + api_account_log

# 查询（get）参数信息
params = {
    "source": 1,
    "type": 1
}

# 请求头信息
headers = {
    "Authorization": "Basic ZGV5dW5jZTo4MjgxMjM=",
    "token": "65be7ef189fa84fea25795b82e0a189d"
}

res = requests.get(url=url_account_log, headers=headers, params=params)
# print(res.text)

# 把响应信息转成字典格式
res_json = res.json()
data = res_json["data"]
# print(f"data = {data}")

list_1 = data["list"]
# print(f"list = {list_1}")  # [{},{},{}....]
# 最新的一次增加余额的信息
new_time = list_1[0]["create_time"]
print(f"最近一次余额增加的时间是 {new_time}")
